<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@page contentType="text/html;charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>当当图书 – 全球最大的中文网上书店</title>
		<link href="${pageContext.request.contextPath}/css/book.css" rel="stylesheet" type="text/css" />
		<link href="${pageContext.request.contextPath}/css/second.css" rel="stylesheet" type="text/css" />
		<link href="${pageContext.request.contextPath}/css/secBook_Show.css" rel="stylesheet" type="text/css" />
		<link href="${pageContext.request.contextPath}/css/list.css" rel="stylesheet" type="text/css" />
	</head>
	<body>
		&nbsp;

		<!-- 头部开始 -->
		<%@include file="../common/head.jsp"%>
		<!-- 头部结束 -->

		<div style="width: 962px; margin: auto;">
			<a href="#"><img src="${pageContext.request.contextPath}/images/default/book_banner_081203.jpg" border="0" /> </a>
		</div>
		<div class='your_position'>
			您现在的位置:&nbsp;
			<a href="${pageContext.request.contextPath}/book/selectByChoice.do">当当图书</a> &gt;&gt;
			<a href="${pageContext.request.contextPath}/book/selectByFid.do?fid=${pcategory.id}"><font style='color: #cc3300'>${pcategory.name}<strong></strong></font></a>&gt;&gt;
			<a href="${pageContext.request.contextPath}/book/selectBySid.do?sid=${category.id}"><font style='color: #cc3300'><strong>${category.name}</strong></font></a>
		</div>

		<div class="book">

			<!--左栏开始-->
			<div id="left" class="book_left">
				<div id="__fenleiliulan">
					<div class=second_l_border2>
						<h2>
							分类浏览
						</h2>
						<ul>
							<li>
								<div>
									<div class=second_fenlei>
										<a href="${pageContext.request.contextPath}/book/selectByFid.do?fid=${pcategory.id}">全部&nbsp;(<span id="s1"></span>)</a>
									</div>
								</div>
							</li>
							<div class="clear"></div>
							
							<!--2级分类开始-->

							<c:forEach items="${categories}" var="catecount">
							<li>
								<div>

									<div class=second_fenlei>
										<a href="${pageContext.request.contextPath}/book/selectBySid.do?sid=${catecount.id}">${catecount.name}&nbsp;(<span class="bookNum">${catecount.counts}</span>)</a>
									</div>
								</div>
							</li>
								<div class="clear"></div>
							</c:forEach>
							<!--2级分类结束-->

						</ul>
					</div>
				</div>
			</div>

			<!--左栏结束-->

			<!--中栏开始-->
			<div class="book_center">

				<!--图书列表开始-->
				<div id="divRight" class="list_right">

					<div id="book_list" class="list_r_title">
						<div id="divTopPageNavi" class="list_r_title_text3">

							<!--分页导航开始-->
							<c:if test="${pageInfo.hasPreviousPage}">
								<c:if test="${!empty fid}">
							<div class='list_r_title_text3a'>
								<a name=link_page_next
									href="${pageContext.request.contextPath}/book/selectByFid.do?pageNo=${pageInfo.prePage}&fid=${fid}">
								<img src='${pageContext.request.contextPath}/images/page_up.gif' /> </a>
							</div>
								</c:if>
								<c:if test="${!empty sid}">
									<div class='list_r_title_text3a'>
										<a name=link_page_next
										   href="${pageContext.request.contextPath}/book/selectBySid.do?pageNo=${pageInfo.prePage}&sid=${sid}">
											<img src='${pageContext.request.contextPath}/images/page_up.gif' /> </a>
									</div>
								</c:if>
							</c:if>
							<c:if test="${!pageInfo.hasPreviousPage and pageInfo.pages>0}">
							<div class='list_r_title_text3a'>
								<img src='${pageContext.request.contextPath}/images/page_up_gray.gif' />
							</div>
							</c:if>
							<c:if test="${pageInfo.pages>0}">
							<div class='list_r_title_text3b'>
								第${pageInfo.pageNum}页/共${pageInfo.pages}页
							</div>
							</c:if>
							<c:if test="${pageInfo.hasNextPage}">
								<c:if test="${!empty fid}">
							<div class='list_r_title_text3a'>
								<a name=link_page_next
								   href="${pageContext.request.contextPath}/book/selectByFid.do?pageNo=${pageInfo.nextPage}&fid=${fid}">
									<img src='${pageContext.request.contextPath}/images/page_down.gif' /> </a>
							</div>
								</c:if>
								<c:if test="${!empty sid}">
									<div class='list_r_title_text3a'>
										<a name=link_page_next
										   href="${pageContext.request.contextPath}/book/selectBySid.do?pageNo=${pageInfo.nextPage}&sid=${sid}">
											<img src='${pageContext.request.contextPath}/images/page_down.gif' /> </a>
									</div>
								</c:if>
							</c:if>
							<c:if test="${!pageInfo.hasNextPage and pageInfo.pages>0}">
								<div class='list_r_title_text3a'>
									<img src='${pageContext.request.contextPath}/images/page_down_gray.gif' />
								</div>
							</c:if>

							<!--分页导航结束-->
						</div>
					</div>
					
					<!--商品条目开始-->
						<c:forEach items="${pageInfo.list}" var="pi">
						<div class="list_r_line"></div>
						<div class="clear"></div>

						<div class="list_r_list">
							<span class="list_r_list_book"><a name="link_prd_img"
															  href="${pageContext.request.contextPath}/book/showOne.do?id=${pi.id}">
								<img src="${pageContext.request.contextPath}/productImages/${pi.image}" /> </a> </span>
							<h2>
								<a name="link_prd_name" href="${pageContext.request.contextPath}/book/showOne.do?id=${pi.id}">${pi.name}</a>
							</h2>
							<h3>
								顾客评分：100
							</h3>
							<h4 class="list_r_list_h4">
								作 者:
								<a href='#' name='作者'>${pi.author}</a>
							</h4>
							<h4>
								出版社：
								<a href='#' name='出版社'>当当出版社</a>
							</h4>
							<h4>
								出版时间：<fmt:formatDate value="${pi.date}" pattern="yyyy年MM月dd日"/>
							</h4>
							<h5>
								${pi.messages}
							</h5>
							<div class="clear"></div>
							<h6>
								<span class="del">￥${pi.price}</span>
								<span class="red">￥${pi.dangPrice}</span>
								节省：￥${pi.price-pi.dangPrice}
							</h6>
							<span class="list_r_list_button"> 
							<a href="#"> 
							<img src='${pageContext.request.contextPath}/images/buttom_goumai.gif' /> </a>
							<span id="cartinfo"></span>
						</div>
						<div class="clear"></div>

						</c:forEach>
						<!--商品条目结束-->

					<div class="clear"></div>
					<div id="divBottomPageNavi" class="fanye_bottom">
					</div>

				</div>
				<!--图书列表结束-->

			</div>
			<!--中栏结束-->
			<div class="clear"></div>
		</div>

		<!--页尾开始 -->
		<%@include file="../common/foot.jsp"%>
		<!--页尾结束 -->
	<script type="text/javascript">
		var span = document.querySelectorAll("span.bookNum");
		var num = 0;
		span.forEach(function(spanv,book){
			num+=Number.parseInt(spanv.innerHTML)
		})
		var s1 = document.querySelector("#s1");
		s1.innerHTML=num
	</script>
	</body>
</html>
